import React from 'react';
import { Link } from 'react-router-dom'
import './index.scss';

import { observer, inject } from 'mobx-react';

import UserApi from '@src/service/UserApi'
import { message } from 'antd';

class TopHeader extends React.Component {

    constructor(props) {
        super(props);
        this.exit = this.exit.bind(this);
    }

    exit() {
        localStorage.clear();
        UserApi.LoginOut().then(res => {
            message.success('登出成功,正在跳转');
            window.location.href = "/login.html";
        })
    }

    render() {
        return (
            <div className="compt TopHeader">

                <div className="top-header-container">
                    <div className="top-header-one">
                        <div className="site-name">KEDACOM</div>
                        <div className="site-name-split">|</div>
                        <div className="site-name-sub">基本React应用示例</div>
                    </div>
                    <div className="top-header-two">
                        <Link to="/One">页面一</Link>
                        <Link to="/Two">页面二</Link>
                    </div>
                    <div className="top-header-three">
                        <a className="exitBtn" onClick={this.exit}>退出</a>
                    </div>

                </div>

            </div>
        );
    }
}
export default TopHeader;